//
//  EmptyUtils.m
//  Meets-ios
//
//  Created by liumingkong on 14-6-20.
//  Copyright (c) 2014年 meets. All rights reserved.
//

#import "EmptyUtils.h"

@implementation EmptyUtils

+ (BOOL) isNull:(id) obj {
    if (obj == nil || obj == NULL) return YES;
    return NO;
}

+ (BOOL) isEmptyString:(NSString *) str {
    if (![EmptyUtils isNull:str]) {
        NSString *tmp = [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
        NSString *trimFinalStr = [tmp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
        if ([trimFinalStr length] != 0) {
            return NO;
        }
    }
    return YES;
}

+ (BOOL) isEmptyNSMutableArray:(NSMutableArray *) nsMutableArray {
    if (![EmptyUtils isNull:nsMutableArray]) {
        if ([nsMutableArray count] != 0) {
            return NO;
        }
    }
    return YES;
}

+ (BOOL) isEmptyNSArray:(NSArray *) nsArray {
    if (![EmptyUtils isNull:nsArray]) {
        if ([nsArray count] != 0) {
            return NO;
        }
    }
    return YES;
}

+ (BOOL) isEmptyNSDictionary:(NSDictionary *) nsDictionary {
    if (![EmptyUtils isNull:nsDictionary]) {
        if ([nsDictionary count] != 0) {
            return NO;
        }
    }
    return YES;
}

+ (BOOL) isEmptyNSSet:(NSSet *) nsSet {
    if (![EmptyUtils isNull:nsSet]) {
        if ([nsSet count] != 0) {
            return NO;
        }
    }
    return YES;
}

+ (BOOL) isEmptyNSMutableSet:(NSMutableSet *) nsSet {
    if (![EmptyUtils isNull:nsSet]) {
        if ([nsSet count] != 0) {
            return NO;
        }
    }
    return YES;
}

+ (BOOL) isZeroInt:(int) num {
    if (num == 0) {
        return YES;
    } else {
        return NO;
    }
}

+ (BOOL) isZeroDouble:(double) num {
    if (num == 0) {
        return YES;
    } else {
        return NO;
    }
}

+ (BOOL) isZeroLong:(long) num {
    if (num == 0) {
        return YES;
    } else {
        return NO;
    }
}

+ (BOOL) isZeroLongLong:(long long) num {
    if (num == 0) {
        return YES;
    } else {
        return NO;
    }
}

@end
